<style lang="less">
@import './index.less';
</style>
<template>
  <div class="login" v-if="is_show">
    <div class="login-con" style="top: 40%;right:70px;width:400px;">
      <hd-login :loginStyle="loginStyle" :fun="beforeLogin"></hd-login>
    </div>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
import bg from '@/assets/images/login-bg.jpg'
export default {
  data () {
    return {
      loginStyle: {
        backgroundImage: 'url(' + bg + ')'
      },
      is_show: false,
      data: {
        userName: '',
        password: ''
      }
    }
  },
  components: {
    // LoginForm
  },
  mounted (option) {
    console.log(this.$route.query.username, '12222')
    if (this.$route.query.username) {
      this.handleSubmit({ userName: this.$route.query.username, password: '000000' })
    } else {
      this.is_show = true
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo'
    ]),
    async beforeLogin () {
      let rest = await this.getUserInfo()
      console.log(rest)
      if (rest.errcode === 0) {
        return true
      } else {
        return true
      }
    }
  }
}
</script>

<style>

</style>
